﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using XGame.Tools.PathFind;

namespace XGame.Tools
{
    public static class Utility
    {
        public enum Direction
        {
            North = 0, NorthEast = 1, East = 2, SouthEast = 3, South = 4, SouthWest = 5, West = 6, NorthWest = 7
        }

        //private static Texture2D simpleTexture;
        //private static Texture2D InitSimpleTexture(GraphicsDevice graphicsDevice)
        //{
        //    if (simpleTexture == null)
        //    {
        //        simpleTexture = new Texture2D(graphicsDevice, 1, 1, false, SurfaceFormat.Color);

        //        Int32[] pixel = { 0x0000FF }; // White. 0xFF is Red, 0xFF0000 is Blue
        //        simpleTexture.SetData<Int32>(pixel, 0, simpleTexture.Width * simpleTexture.Height);
        //    }
        //    return simpleTexture;
        //}
        //public static void DrawRectangle(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, Rectangle rectangle, bool isFill)
        //{
        //    if (isFill == true)
        //        spriteBatch.Draw(InitSimpleTexture(graphicsDevice), rectangle, Color.White);
        //    else
        //    {
        //        spriteBatch.Draw(InitSimpleTexture(graphicsDevice), new Rectangle(rectangle.Left, rectangle.Top, rectangle.Width, 1), Color.White);
        //        spriteBatch.Draw(InitSimpleTexture(graphicsDevice), new Rectangle(rectangle.Right, rectangle.Top, 1, rectangle.Height), Color.White);
        //        spriteBatch.Draw(InitSimpleTexture(graphicsDevice), new Rectangle(rectangle.Left, rectangle.Top, 1, rectangle.Height), Color.White);
        //        spriteBatch.Draw(InitSimpleTexture(graphicsDevice), new Rectangle(rectangle.Left, rectangle.Bottom, rectangle.Width, 1), Color.White);
        //    }
        //}
        //public static void DrawSimpleHorizontalLine(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, int y, int leftX, int rightX)
        //{
        //    // Paint a Line
        //    spriteBatch.Draw(InitSimpleTexture(graphicsDevice), new Rectangle(leftX, y, rightX - leftX, 1), Color.White);
        //}
        //public static void DrawSimpleVerticalLine(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, int x, int upY, int downY)
        //{
        //    // Paint a Line
        //    spriteBatch.Draw(InitSimpleTexture(graphicsDevice), new Rectangle(x, upY, 1, downY - upY), Color.White);
        //}
        public static Direction GetOppositeDirection(Direction dir)
        {
            return (Direction)(7 - (int)dir);
        }

    }
}
